package br.ufmg.dcc.simulesspl.model;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import org.junit.Test;

public class SprintTest {

	@Test
	public void anEngineerShouldProduceAsMuchAsHisSkillAttribute() {
		Sprint sprint = new Sprint();
		sprint.setDeveloper(new EngineerCard(3, 1, 2));
		assertThat(sprint.getCode(), equalTo(3));
	}
	
	@Test
	public void bugsShouldBeGeneratedDuringDevelopment() {
		EngineerCard engWhoAlwaysCreatesBugs = new EngineerCard(1, 2, 3) {
			@Override
			public double getBugProbability() {
				return 1;
			}
		};
		
		Sprint sprint = new Sprint();
		sprint.setDeveloper(engWhoAlwaysCreatesBugs);
		assertThat(sprint.getBugs(), equalTo(1));
	}
	
	@Test
	public void bugFixesShouldBeOneWhenWeAddABugFixer() {
		EngineerCard anEngineerWithAnyAttributes = new EngineerCard(1, 2, 3);
		
		Sprint sprint = new Sprint();
		assertThat(sprint.getBugFixes(), equalTo(0));
		sprint.setBugFixer(anEngineerWithAnyAttributes);
		assertThat(sprint.getBugFixes(), equalTo(1));
	}
}
